package am.core;

import am.bll.BookEditor;
import am.bll.BookReader;
import am.bll.BookWriter;
import am.bll.ItemEditor;
import am.bll.ItemReader;
import am.bll.ItemSorter;
import am.bll.ItemWriter;
import am.bll.stub.AccountBookManagementStub;
import am.bll.stub.AccountItemManagementStub;
import am.ui.BookCreateActivity;
import am.ui.BookDetailActivity;
import am.ui.BookListActivity;
import am.ui.ItemCreateActivity;
import am.ui.ItemDetailActivity;
import am.ui.ItemListActivity;

public class Configuration
{
    public void init()
    {
        // 调试用
        setBllStub();
    }

    private void setBllStub()
    {
        // 桩
        AccountBookManagementStub abms = new AccountBookManagementStub();
        AccountItemManagementStub aims = new AccountItemManagementStub();

        // 接口
        BookReader bookReader = abms;
        BookWriter bookWriter = abms;
        BookEditor bookEditor = abms;
        ItemReader itemReader = aims;
        ItemWriter itemWriter = aims;
        ItemSorter itemSorter = aims;
        ItemEditor itemEditor = aims;

        // 类
        BookCreateActivity.setBookWriter(bookWriter);
        BookDetailActivity.setBookEditor(bookEditor);
        BookDetailActivity.setBookReader(bookReader);
        BookListActivity.setBookReader(bookReader);
        ItemCreateActivity.setItemWriter(itemWriter);
        ItemDetailActivity.setItemEditor(itemEditor);
        ItemDetailActivity.setItemReader(itemReader);
        ItemListActivity.setItemReader(itemReader);
        ItemListActivity.setItemSorter(itemSorter);
    }
}
